/*
 *	This file is part of Lounge-Cast.
 *
 *  Author:  	Markus Moormann
 *	E-mail:  	mmoorman@uni-osnabrueck.de
 *	Copyright:	University of Osnabrueck (Zentrum Virtuos)
 * 	Website:	www.uni-osnabrueck.de
 *	Date:		16.02.2011
 *
 *	Lounge-Cast is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *	Lounge-Cast is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Lounge-Cast.  If not, see <http://www.gnu.org/licenses/>.
 */
package multimedia.view.renderer
{
	import flash.events.MouseEvent;
	
	import multimedia.control.event.preview.ChangeStateEvent;
	import multimedia.control.event.preview.LoadDFXPXMLEvent;
	import multimedia.control.event.preview.LoadImageEvent;
	import multimedia.control.event.preview.LoadSlideEvent;
	import multimedia.control.event.preview.LoadTextEvent;
	import multimedia.control.event.preview.LoadVideoEvent;
	import multimedia.control.event.preview.LoadViewerXMLEvent;
	import multimedia.model.ModelLocator;
	import multimedia.model.vo.MediaVO;
	import multimedia.view.components.MediaPreview;
	
	import mx.controls.treeClasses.TreeListData;
	import mx.managers.PopUpManager;

	public class PreviewMediaButton extends ImageBorder
	{

		[Bindable]
		private var model:ModelLocator;

		public function PreviewMediaButton()
		{
			super();
			this.source = "multimedia/assets/television-image.png";
			this.width = 16;
			this.height = 16;
			this.toolTip = "Zeige Medium in der Vorschau";
			model = ModelLocator.getInstance();
			addEventListener(MouseEvent.CLICK, previewMedia);
		}


		// Our privately held node data
		private var _node:TreeListData;

		// getter for node data
		[Bindable]
		public function get node():TreeListData
		{
			return _node;
		}

		// setter for node data
		public function set node(value:TreeListData):void
		{
			this._node = value;
		}

		private function previewMedia(event:MouseEvent):void
		{
			var _media:MediaVO = _node.item as MediaVO
			var preview:MediaPreview = new MediaPreview();
			preview.media = _media;
			PopUpManager.addPopUp(preview, this, true);
		}

	}
}